<template>
  <div style="padding: 20px">
    <el-tabs type="border-card">
      <el-tab-pane label="积分套餐配置" name="first">
        <el-table :data="list" style="width: 100%">
          <el-table-column prop="name" label="名称" width="width">
          </el-table-column>
          <el-table-column prop="points" label="积分数" width="width">
          </el-table-column>
          <el-table-column prop="expense" label="服务价格" width="width">
            <template slot-scope="scope"> ￥ {{ scope.row.expense }} </template>
          </el-table-column>
          <el-table-column prop="prop" label="显示状态" width="width">
            <template slot-scope="scope">
              <el-tag :type="scope.row.is_display ? 'success' : 'danger'">{{
                scope.row.is_display ? "显示" : "隐藏"
              }}</el-tag>
            </template>
          </el-table-column>
          <el-table-column prop="prop" label="推荐" width="width">
            <template slot-scope="scope">
              <el-tag :type="scope.row.recommend ? 'success' : 'danger'">{{
                scope.row.recommend ? "是" : "否"
              }}</el-tag>
            </template>
          </el-table-column>
          <el-table-column prop="sort_id" label="排序" width="width">
          </el-table-column>
          <el-table-column prop="prop" label="操作" width="width">
            <template>
              <el-button
                type="primary"
                size="small"
                @click="editPointsDialog = true"
                >编辑</el-button
              >
              <el-button type="danger" size="small" @click="delBtn"
                >删除</el-button
              >
            </template>
          </el-table-column>
        </el-table>
        <el-button
          type="primary"
          style="margin-top: 20px"
          size="small"
          @click="addPointsDialog = true"
          >添加</el-button
        >
      </el-tab-pane>
    </el-tabs>
    <addPoints :addPointsDialog.sync="addPointsDialog" />
    <editPoints :editPointsDialog.sync="editPointsDialog" />
  </div>
</template>

<script>
import addPoints from "@/views/platformSystem/qyBusinessConfig/pointsSetMenu/components/addPoints";
import editPoints from "@/views/platformSystem/qyBusinessConfig/pointsSetMenu/components/editPoints";
export default {
  components: {
    addPoints,
    editPoints,
  },
  data() {
    return {
      addPointsDialog: false,
      editPointsDialog: false,
      list: [
        {
          id: 1,
          name: "100点积分",
          recommend: 0,
          points: 100,
          expense: "9.80",
          is_display: 0,
          sort_id: 0,
        },
        {
          id: 2,
          name: "200点积分",
          recommend: 0,
          points: 200,
          expense: "18.00",
          is_display: 0,
          sort_id: 0,
        },
        {
          id: 3,
          name: "300点积分",
          recommend: 0,
          points: 300,
          expense: "28.88",
          is_display: 0,
          sort_id: 0,
        },
      ],
      tableData: [
        {
          refreshTime: "刷新时间一天之内",
          price: 0,
          unit: "元",
        },
        {
          refreshTime: "刷新时间三天之内",
          price: 0,
          unit: "元",
        },
        {
          refreshTime: "刷新时间五天之内",
          price: 0,
          unit: "元",
        },
        {
          refreshTime: "刷新时间五天以上",
          price: 0,
          unit: "元",
        },
      ],
    };
  },
  methods: {
    delBtn() {
      this.$confirm("此操作将永久删除该数据, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          this.$message({
            type: "success",
            message: "删除成功!",
          });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消删除",
          });
        });
    },
  },
};
</script>

<style scoped>
h3 {
  margin-bottom: 20px;
}
</style>
